package com.ylyq.ylxx.constants;

public class ShiroConstant {

    public enum TokenType{
        ADMIN("1", "admin"),ADDROID("2", "android"),IOS("3", "ios"),QWWECHAT("4", "qwwechat")
        ,WECHAT("5", "wechat");

        private String code;
        private String msg;

        // 构造方法
        private TokenType(String code, String sms) {
            this.code = code;
            this.msg = sms;
        }

        // 普通方法
        public static String getName(String code) {
            for (TokenType c : TokenType.values()) {
                if (c.getCode().equals(code)) {
                    return c.msg;
                }
            }
            return null;
        }

        // 普通方法
        public static String getType(String msg) {
            for (TokenType c : TokenType.values()) {
                if (c.getMsg().equals(msg)) {
                    return c.code;
                }
            }
            return null;
        }

        public String getCode() {
            return code;
        }

        public void setCode(String code) {
            this.code = code;
        }

        public String getMsg() {
            return msg;
        }

        public void setMsg(String msg) {
            this.msg = msg;
        }
    }

    /**
     * Token类型
     */
    public static final String TOKEN_TYPE = "type";

    /**
     * Authorization
     */
//    public final static String CONTEXT_TOKEN = "Authorization";

    /**
     * token
     */
    public final static String TOKEN = "token";
    /**
     * OceaneToken
     */
    public final static String OceaneToken = "OceaneToken";
    /**
     * LubanToken
     */
    public final static String LubanToken = "LubanToken";

    /**
     * contextUserId
     */
    public final static String CONTEXT_USER_ID = "contextUserId";

    /**
     * contextUserName
     */
    public final static String CONTEXT_USER_NAME = "contextUserName";

    /**
     * 服务之间token_user
     */
    public final static String CONTEXT_TOKEN_USER ="token_user";

    /**
     * renewalTime
     */
    public final static String RENEWAL_TIME =  "renewalTime";

    /**
     *  jwt 加密秘钥
     */

    public final static String JWT_PRIVATE_KEY ="oacloudjwtprivatekey_";

    /**
     * 前缀accessToken
     */
    public final static String ACCESSTOKEN_KEY_PREFIX =  "accessToken:";
}
